package ciyuan.Gui.Ornaments;

import ciyuan.MainClass;
import com.mojang.blaze3d.matrix.MatrixStack;
import com.mojang.blaze3d.systems.RenderSystem;
import net.minecraft.client.gui.screen.inventory.ContainerScreen;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.text.ITextComponent;

/**
 * @author 150149
 */
public class OrnamentsScreen extends ContainerScreen<OrnamentsContainer> {

    private static final ResourceLocation ORNAMENTS_BACKGROUND = new ResourceLocation(MainClass.MODID, "textures/gui/ornament.png");

    public OrnamentsScreen(OrnamentsContainer p_i51105_1_, PlayerInventory p_i51105_2_, ITextComponent p_i51105_3_) {
        super(p_i51105_1_, p_i51105_2_, p_i51105_3_);
    }

    @Override
    public void render(MatrixStack matrixStack, int mouseX, int mouseY, float particleTick) {
        super.render(matrixStack, mouseX, mouseY, particleTick);
        if (this.minecraft.player.inventory.getCarried().isEmpty() && this.hoveredSlot != null && this.hoveredSlot.hasItem()) {
            this.renderTooltip(matrixStack, this.hoveredSlot.getItem(), mouseX, mouseY);
        }
    }

    @Override
    protected void renderBg(MatrixStack matrixStack, float particleTick, int mouseX, int mouseY) {
        renderBackground(matrixStack);
        RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F);
        this.minecraft.getTextureManager().bind(ORNAMENTS_BACKGROUND);
        int textureWidth = 300;
        int textureHeight = 166;
        blit(matrixStack, this.leftPos - 62, this.topPos, 0, 0, textureWidth, textureHeight, textureWidth, textureHeight);
    }
}
